from sort_A_simply_sort import simply_sort

size, n = int(input()), int(input())
shoes = list(map(int, input().split()))
count = 0

for i in range(len(simply_sort(shoes))):
    if shoes[i] - size >= 3:
        count += 1
        size = shoes[i]

print(count)
